#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(int argc,char* argv[]){
	int i;
	FILE *f;
	unsigned len;
	const char p[]={'A','C','G','T'};
	
	if(argc<3){
		printf("%s outfile num_symbols\n",*argv);
		return 0;
	}

	if(!(f=fopen(argv[1],"w")) ){
		perror(argv[1]);
		return 1;
	}

	if( sscanf(argv[2],"%u",&len) !=1){
		perror(argv[2]);
		return 2;
	}
	
	srand((unsigned)time(0));
	
	while(len>0){
		for(i=0;i<80 && len>0;i++){
			fputc(p[rand()&3],f);len--;}
		if(len>0)fputc('\n',f);
	}

	fclose(f);
	return 0;
}
